# Embed the server root certificate into the final binary
idf_build_get_property(project_dir PROJECT_DIR)

file(GLOB_RECURSE SOURCES "main.c")

if (CONFIG_USING_SD_CARD)
list(APPEND SOURCES "sd_fatfs.c")
endif()

if (CONFIG_USING_LCD)
list(APPEND SOURCES "lcd_driver.c")
endif()

if (CONFIG_USING_AHT20)
list(APPEND SOURCES "aht20_driver.c")
endif()

if (CONFIG_USING_SHT3X)
list(APPEND SOURCES "sht3x_driver.c")
endif()

if (CONFIG_USING_BEEP)
list(APPEND SOURCES "beep_driver.c")
endif()

# test
if (CONFIG_USING_EPD)
list(APPEND SOURCES "epd4in7_test.c")
endif()

idf_component_register(SRCS ${SOURCES}
                    INCLUDE_DIRS ".")

# add macro
idf_build_set_property(
    COMPILE_DEFINITIONS "-DPIKA_CONFIG_ENABLE" APPEND)

idf_build_set_property(
    COMPILE_DEFINITIONS "-DLV_LVGL_H_INCLUDE_SIMPLE" APPEND)

idf_build_set_property(
    COMPILE_DEFINITIONS "-DPIKASCRIPT" APPEND)
